{% extends "base.html" %}

{%block title%}Sprawdzanie kuponu{%endblock%}

{%block head%}
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <script src="{{MEDIA_URL}}/js/jquery-ui.datepicker-pl.js"></script>
    <script>
        $(document).ready(function() {
            $("#id_date").datepicker($.datepicker.regional['pl']);
        });
    </script>
{%endblock%}

{%block content%}
	<div id="content">
		<div class="post">
			<div class="title">
				<h2>Sprawdzanie kuponu</h2>
			</div>
			<div class="entry">
			    <form method="POST" action="{%url check%}">
			    {% csrf_token %}
			        {{form.mode}} <span class="m-l m-r">{{form.date}}</span> {{form.quantity}}
			        {{form.nums}}
	                <input type="submit" id="pick" value="Sprawdź" />
            	</form>
            	<br />
            	{%if value%}
	            	<table>
					    <thead>
			    			<tr>
				        		<th class="br-tl">Nr losowania</th>
				        		<th>Data</th>
				        		<th>Wylosowane liczby</th>
				        		<th class="br-tr">Trafione liczby</th>
				    		</tr>
			    		</thead>
			    		<tbody>
			                {%for v in value%}
			                <tr>
			                    <td>{{v.0}}</td>
			                    <td>{{v.1}}</td>
			        			<td><pre>{{v.2}}</pre></td>
			        			<td><pre>{{v.3}}</pre></td>
					    	</tr>
			                {%endfor%}
			            </tbody>
		            </table>
		        {%elif form.date.value and not form.nums.value%}
		            Zaznacz liczbę(y)!
				{%elif form.date.value and form.nums.value%}
					Dnia {{form.date.value}} nie odbyło się losowanie podanej gry.
		       	{%endif%}
			</div>
		</div>
	</div>
{%endblock%}
